package com.fin.quant.common;

/**
 * 消息角色枚举
 */
public enum MessageRole {
    USER("user"), ASSISTANT("assistant"), SYSTEM("system");

    private final String value;

    MessageRole(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    /**
     * 根据字符串值获取对应的枚举实例
     *
     * @param value 字符串值
     * @return 对应的MessageRole枚举实例
     * @throws IllegalArgumentException 如果没有匹配的枚举值
     */
    public static MessageRole fromValue(String value) {
        for (MessageRole role : MessageRole.values()) {
            if (role.value.equals(value)) {
                return role;
            }
        }
        throw new IllegalArgumentException("No matching constant for [" + value + "]");
    }

}
